﻿<!--#include file="h.asp"--><%
'
'	七色虎建站系统
'	访客在线页面
'	2011.2.1

Sub main
	Dim body_,id,rs,sql,time_,userid_,user_,url_,urlLink_,time__
	Dim count,pagecount,page,i,pagesize,pagenum
	pagesize=10
	page=getN("page",1)
	hu.title = "在线访客"
	body_ = checkMsg()'信息
	body_ = body_ & "[div=nav]-"&hu.url("?aid=index","首页")&"-在线访客[/div]"
	time_ = dateadd("n", -20, time_now)
	sql="select link,userid,hu_userip,time from 74hu_iprr where ([time]>#"&time_&"#) order by [time] desc"
	Set rs = Server.CreateObject("ADODB.Recordset")
	rs.open sql, hu.db, 1, 1
	If Not rs.eof Then
		count = rs.recordcount
		body_ = body_ & "有"&count&"位访客在线<br/>"
		pagecount=(count+pagesize-1)\pagesize
		if page>pagecount then page=pagecount
		pagenum=pagesize*(page-1)*1
		rs.move(pagenum)
		For i=1 To PageSize
			If rs.eof Then Exit For
				userid_ = rs("userid")
				url_ = rs("link")
				time__ = DateDiff("s", rs("time"), time_now)
				If userid_=0 Then
					user_ ="游客"&Left(Replace(rs("hu_userip"),".",""),4)
				Else
					user_ = hu.url("bbs_user.asp?id="&userid_,getUserName(userid_))
				End If
				If url_<>"" Then
					urlLink_ = Replace(url_ , "[sid]", sid_str)
				Else
					urlLink_ = "其他页面.."
				End If
				body_ = body_ & forTimeDiff(time__)&"前，"&user_&"正在看"&urlLink_&"<br/>"
			rs.movenext
		Next
		body_ = body_ & showPage("online.asp", "", page, pagecount)
	Else
		body_ = body_ & "没有访客在线<br/>"
	End If
	rs.close
	Set rs=Nothing
	hu.body = comUbb(body_)
End Sub

%>